package com.jike.mahjong.common;


public class Page {

	private int pageSize = 10; // 每页的记录数

	private int start = 0; // 当前页第一条数据在List中的位置,从0开始

	private Object data; // 当前页中存放的记录,类型一般为List

	private Object extData;
	
	private Object extColumData;
	
	private int totalCount = 0; // 总记录数
	
	private int maxPage = 0; // 总页数
	
	private int currentPage = 1;  //当前页码
	
	private boolean nextPage = false;  //是否有下一页
	
	private boolean previousPage = false;  //是否有前一页
	
	
	
	
	public Object getExtColumData() {
		return extColumData;
	}

	public void setExtColumData(Object extColumData) {
		this.extColumData = extColumData;
	}

	public Object getExtData() {
		return extData;
	}

	public void setExtData(Object extData) {
		this.extData = extData;
	}

	public int getTotalCount() {
		return this.totalCount;
	}

	public int getPageSize() {
		return pageSize;
	}

	public int getCurrentPageNo() {
		return start / pageSize + 1;
	}

	public static int getStartOfPage(int pageNo, int pageSize) {
		return (pageNo - 1) * pageSize;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public boolean isNextPage() {
		return this.getCurrentPageNo() < this.getTotalPage() - 1;
	}

	public void setNextPage(boolean nextPage) {
		this.nextPage = nextPage;
	}

	public boolean isPreviousPage() {
		return this.getCurrentPageNo() > 1;
	}

	public void setPreviousPage(boolean previousPage) {
		this.previousPage = previousPage;
	}

	public int getTotalPage() {
		if (totalCount % pageSize == 0)
			return totalCount / pageSize;
		else
			return totalCount / pageSize + 1;
	}

	public void setMaxPage(int maxPage) {
		this.maxPage = maxPage;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getMaxPage() {
		return this.getTotalPage();
	}

}